/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.meego.common.io;

import java.io.File;
import java.util.StringTokenizer;

/**
 *
 * @author TueHM
 */
public class Directory {
    public static String getDirectoryPath(String file) {
        StringTokenizer tok = new StringTokenizer(file.replace("\\", File.separator).replace("/", File.separator), File.separator);
        while (tok.hasMoreTokens()) {
            String currDirName = tok.nextToken();
            if (tok.hasMoreTokens()) {
                continue;
            }
            if (currDirName.lastIndexOf(".") > 0) {
                file = file.substring(0, file.length() - currDirName.length());
            }
        }
        return file;
    }

}
